
> # set up environment ----
> library(data.table)

> library(nnet)

> library(RColorBrewer)

> library(ggplot2)

> library(cowplot)

> load("data/analysis_data.RData")

> source("R/00-functions.R")

> set.seed(1991975877)

> respondent_data[n_attention_fails <= 1 & trump_least_preferred == 1 &
+     support_2016 != "Trump",
+   .N / 833, type3]
              type3        V1
             <fctr>     <num>
1:      preferences 0.4153661
2:     electability 0.2076831
3: expected_utility 0.3769508

> # average treatment effect tests ----
> # main dataset
> respondent_data[n_attention_fails <= 1 & trump_least_preferred == 1 &
+     support_2016 != "Trump",
+   chisq.test(electability_last, type3)]

	Pearson's Chi-squared test

data:  electability_last and type3
X-squared = 19.031, df = 2, p-value = 7.371e-05


> respondent_data[n_attention_fails <= 1 & trump_least_preferred == 1 &
+     support_2016 != "Trump",
+   fisher.test(electability_last, type3)]

	Fisher's Exact Test for Count Data

data:  electability_last and type3
p-value = 6.915e-05
alternative hypothesis: two.sided


> # full dataset
> respondent_data[, chisq.test(electability_last, type3)]

	Pearson's Chi-squared test

data:  electability_last and type3
X-squared = 22.873, df = 2, p-value = 1.08e-05


> respondent_data[, fisher.test(electability_last, type3)]

	Fisher's Exact Test for Count Data

data:  electability_last and type3
p-value = 1.062e-05
alternative hypothesis: two.sided


> # correlation matrix ----
> respondent_data[, cor(cbind(need_for_cognition, campaign_knowledge,
+   follows_politics, political_interest))]
                   need_for_cognition campaign_knowledge follows_politics political_interest
need_for_cognition          1.0000000          0.1671762        0.2694939          0.2781932
campaign_knowledge          0.1671762          1.0000000        0.1624869          0.2485192
follows_politics            0.2694939          0.1624869        1.0000000          0.6962446
political_interest          0.2781932          0.2485192        0.6962446          1.0000000

> # ATEs ----
> load("results/predicted_probs_main.RData")
Error in load("results/predicted_probs_main.RData") : 
  empty (zero-byte) input file
